package com.itboye.hutouben.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.itboye.hutouben.R;

import java.util.List;

/**
 *搜索列表
 */

public class SouSuoListAdapter extends BaseAdapter {
    Context context;
    List<SouSuoMall> list;

    public SouSuoListAdapter(Context context,List<SouSuoMall> list) {
        this.context=context;
        this.list=list;
    }
    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public View getView(int position, View view, ViewGroup parent) {
        ViewHolder holder;
        if(view==null){
            holder=new ViewHolder();
            view= LayoutInflater.from(context).inflate(R.layout.item_name, null);
            holder.mNameTextView=(TextView) view.findViewById(R.id.name);

            view.setTag(holder);
        }else{
            holder=(ViewHolder) view.getTag();
        }
        holder.mNameTextView.setText(list.get(position).getName());


        return view;
    }
    private class ViewHolder {
        public TextView mNameTextView;
    }
}
